#!/bin/bash

source /etc/profile

workdir=$(cd $(dirname $0); pwd)
source $workdir/config.cfg

# execute device pool
sh $workdir/device_pool/create_device_pool.sh

# execute dws
$workdir/conc_exec_sql.sh $workdir/dws dws

$workdir/conc_exec_sql.sh $workdir/download download

# execute temp table sql
$workdir/conc_exec_sql.sh $workdir/temp/day temp_day
#$workdir/conc_exec_sql.sh $workdir/temp/week temp_week
#$workdir/conc_exec_sql.sh $workdir/temp/month temp_month

# execute report table sql
$workdir/conc_exec_sql.sh $workdir/report report

#execute copy table sql
$workdir/conc_exec_sql.sh $workdir/copy_table copy_table

#export data to mysql
$workdir/export_table.sh

# execute week month
$workdir/conc_exec_sql.sh $workdir/temp/low_priority_day temp_low_priority_day
$workdir/conc_exec_sql.sh $workdir/temp/week temp_week
$workdir/conc_exec_sql.sh $workdir/temp/month temp_month

# execute report table sql
$workdir/conc_exec_sql.sh $workdir/report report

#execute copy table sql
$workdir/conc_exec_sql.sh $workdir/copy_table copy_table

#export data to mysql
$workdir/export_table.sh
